﻿using In66.Net.Repository.Entities;

namespace In66.Net.Share.Domain
{
    public abstract class DomainAbstracEntity : AbstracEntity
    {
        protected DomainAbstracEntity(AuthenticationInfo userContext) : base(userContext)
        {
        }

        protected override IEnumerable<Type> GetEntityTypes(Assembly assembly)
        {
            var typeList = assembly.GetTypes().Where(m =>
                                                       m.FullName != null
                                                       && (typeof(AggregateRoot).IsAssignableFrom(m) || typeof(DomainEntity).IsAssignableFrom(m))
                                                       && !m.IsAbstract);
            if (typeList is null)
            {
                typeList = new List<Type>();
            }

            return typeList.Append(typeof(EventTracker));
        }
    }
}
